﻿namespace Zo.Extensions.Code
{
    public static class JsonCodeExtensions
    {
        /// <summary>
        /// 将代码字符串转成 HTML 格式。
        /// </summary>
        /// <param name="source"></param>
        /// <returns></returns>
        public static string GetJsonCode(this string source)
        {
            return source.Replace("\r\n", "<br/>").Replace(" ", "&nbsp;");
        }

        public static string GetTextCode(this string source)
        {
            return source.Replace("\r\n", "<br/>").Replace(" ", "&nbsp;");
        }
    }
}